/*
 * Footer.cpp
 *
 *  Created on: Jul 5, 2010
 *      Author: bubuntux
 */

#include "Footer.h"

Footer::Footer(Field new_left, Field new_center, Field new_rigth, WINDOW *new_win,
		unsigned int new_padding, unsigned int new_bottom) {
	win = new_win;
	left = new_left;
	center = new_center;
	rigth = new_rigth;
	bottom = new_bottom;
	padding = new_padding;
}

void Footer::print() {
	Ui::printCenter(win, getmaxy(win) - bottom, center);
	attron(COLOR_PAIR(left.color));
	mvwprintw(win, getmaxy(win) - bottom, padding, left.text.c_str());
	attroff(COLOR_PAIR(left.color));
	refreshTime();

}

void Footer::refreshTime() {
	time(&rawtime);
	rigth.text = ctime(&rawtime);
	attron(COLOR_PAIR(rigth.color));
	mvwprintw(win, getmaxy(win) - bottom, getmaxx(win) - rigth.text.length()
			- padding, rigth.text.c_str());
	attroff(COLOR_PAIR(rigth.color));
}

Footer::~Footer() {
	// TODO Auto-generated destructor stub
}
